﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AirLinq.Providers.Sql {
	public class SqlBinaryScalarExpression : SqlExpression{
		private readonly SqlExpression _left;
		private readonly SqlExpression _right;
		private readonly SqlNodeType _nodeType;
		public SqlBinaryScalarExpression(SqlExpression left, SqlNodeType nodeType, SqlExpression right) {
			if (left == null) {
				throw new ArgumentNullException("left");
			}
			if (right == null) {
				throw new ArgumentNullException("right");
			}
			if (nodeType != SqlNodeType.Add
				&& nodeType != SqlNodeType.Sub
				&& nodeType != SqlNodeType.Mul
				&& nodeType != SqlNodeType.Div
				&& nodeType != SqlNodeType.Mod
				&& nodeType != SqlNodeType.BitAnd
				&& nodeType != SqlNodeType.BitOr
				&& nodeType != SqlNodeType.BitXor) {
				throw new ArgumentException("operation must be binary scalar operation");
			}
			_right = right;
			_left = left;
			_nodeType = nodeType;
		}
		public override SqlNodeType NodeType {
			get {
				return _nodeType;
			}
		}
		public SqlExpression Left {
			get {
				return _left;
			}
		}
		public SqlExpression Right {
			get {
				return _right;
			}
		}
		
	}
}
